// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import './permission' // permission control
// import axios from 'axios'
import 'vue-ydui/dist/ydui.rem.css'
import {DateTime} from 'vue-ydui/dist/lib.rem/datetime'

import {Button} from 'vue-ydui/dist/lib.rem/button'
Vue.component(Button.name, Button)
Vue.component(DateTime.name, DateTime)
// Vue.prototype.$axios = axios
Vue.config.productionTip = false

router.onError((error) => {
  const pattern = /Loading chunk (\d)+ failed/g;
  const isChunkLoadFailed = error.message.match(pattern);
  if (isChunkLoadFailed) {
    location.href = 'http://flctec.com/#/person'
  }
});

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
